import { lazy } from 'react';
// 权限认证组件
import Auth from './Auth';
// 页面组件
const Login = lazy(() => import('../pages/Login'));
const Layouts = lazy(() => import('../pages/Layouts'));
const Home = lazy(() => import('../pages/Home'));
const MenuIndex = lazy(() => import('../pages/menu/MenuIndex'));
const RoleIndex = lazy(() => import('../pages/role/RoleIndex'));
const AdminIndex = lazy(() => import('../pages/admin/AdminIndex'));
const RegionIndex = lazy(() => import('../pages/region/RegionIndex'));
const SceneIndex = lazy(() => import('../pages/scene/SceneIndex'));
const ClassifyIndex = lazy(() => import('../pages/classify/ClassifyIndex'));
const BannerIndex = lazy(() => import('../pages/banner/BannerIndex'));
const MemberIndex = lazy(() => import('../pages/member/MemberIndex'));
const PlainIndex = lazy(() => import('../pages/plain/PlainIndex'));
const CategoryIndex = lazy(() => import('../pages/category/CategoryIndex'));
const GoodsIndex = lazy(() => import('../pages/goods/GoodsIndex'));

// 路由规则
const routes = [
    {
        path: '/',
        element: <Auth><Layouts /></Auth>,
        children: [
            {
                path: 'home',
                index: true,
                element: <Auth><Home /></Auth>
            },
            {
                path: 'menu',
                element: <Auth><MenuIndex /></Auth>
            },
            {
                path: 'role',
                element: <Auth><RoleIndex /></Auth>
            },
            {
                path: 'admin',
                element: <Auth><AdminIndex /></Auth>
            },
            {
                path: 'region',
                element: <Auth><RegionIndex /></Auth>
            },
            {
                path: 'scene',
                element: <Auth><SceneIndex /></Auth>
            },
            {
                path: 'classify',
                element: <Auth><ClassifyIndex /></Auth>
            },
            {
                path: 'banner',
                element: <Auth><BannerIndex /></Auth>
            },
            {
                path: 'member',
                element: <Auth><MemberIndex /></Auth>
            },
            {
                path: 'plain',
                element: <Auth><PlainIndex /></Auth>
            },
            {
                path: 'category',
                element: <Auth><CategoryIndex /></Auth>
            },
            {
                path: 'goods',
                element: <Auth><GoodsIndex /></Auth>
            }
        ]
    },
    {
        path: '/login',
        element: <Login />
    }
];
export default routes;